/*
 * @Description: 文件及简介
 * @Author: Cary
 * @Date: 2019-11-16 10:01:53
 * @FilePath: \excel-to-jsone:\work\node-project\cc-tools\webpack.config.js
 */
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin');
const Webpack = require('webpack')
module.exports = {
  //其他参数
  entry: {
    index: './main.js'
  },
  target: 'node',
  output: {
    filename: '[name].node.js',
    path: path.join(__dirname, 'dist')
  },
  watchOptions: {
    ignored: /node_modules/
  },
  // 以下代码为新添加代码
  module: {
    rules: [{
      test: /\.js$/, // 匹配所有 js 文件
      loader: 'babel-loader' // 使用 babel-loader 处理 js 文件
    }]
  },
  plugins: [
    new CopyWebpackPlugin([{
      from: path.resolve(__dirname, './static'),
      to: 'static',
      ignore: ['.*']
    }])
  ],
  optimization: {
    minimize: true
  }

}